import http from "@/api";

import { ResPage } from "@/api/interface";

import { WorkerEntity, CompanyWorkerVo } from "@/biz/interface/WorkerType";

import { ModuleMainUrl } from "..";

const moduleUrl = ModuleMainUrl;

// * 获取工友列表
export const getWorkerVoListApi = (params: {}) => {
  return http.post<ResPage<CompanyWorkerVo>>(moduleUrl + `/cpyswk/mgrvolist`, params);
};

// * 获取工友列表
export const getDownloadWorkerVoListApi = (params: {}) => {
  return http.post<ResPage<CompanyWorkerVo>>(moduleUrl + `/cpyswk/dwnvolist`, params);
};

// * 新增工友接口
export const saveWorkerApi = (worker: WorkerEntity) => {
  return http.post(moduleUrl + `/cpyswk/mgrsave`, worker);
};

// * 详情工友接口
export const getWorkerInfoApi = (params: { id: string }) => {
  return http.post<WorkerEntity>(moduleUrl + `/cpyswk/mgrinfo`, params);
};

// * 删除工友接口
export const deleteWorkerApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpyswk/mgrdelete`, params);
};

// * 修改工友状态接口
export const changeFlagActiveApi = (params: { id: string }) => {
  return http.post(moduleUrl + `/cpyswk/mgractive`, params);
};

// 导出工友
export const exportCompanyWorkerApi = (params: {}) => {
  return http.postexcel(moduleUrl + `/cpyswk/exportworkers`, params);
};

export const exportOneWorkerApi = (params: { id: string }) => {
  return http.postexcel(moduleUrl + `/cpyswk/exponeworker`, params);
};
